# Uncomment the next line to define a global platform for your project
platform :ios, '14.0'
#source 'https://github.com/CocoaPods/Specs.git'

target 'MagaCore' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MagaCore
  pod 'Alamofire'
  pod 'ReSwift'
  pod 'ReSwiftThunk'
  pod 'Moya', '~> 15.0'
  pod 'HandyJSON', '~> 5.0.4-beta'
  pod 'SDWebImageSwiftUI'
  pod 'SwiftyStoreKit'
  pod 'AppLovinSDK'
  pod 'PKHUD'
  pod 'ToastUI'
  pod 'IQKeyboardManagerSwift'
  pod 'Zip', '~> 2.1'
  pod 'FirebaseAuth'
  pod 'FirebaseFirestore'
  pod 'FirebaseMessaging'
  pod 'ProgressHUD'

  pod 'LookinServer'
  target 'MagaCoreTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MagaCoreUITests' do
    # Pods for testing
  end
	
  post_install do |installer|
    installer.pods_project.targets.each do |target|
      # 修改部署目标的部分
      target.build_configurations.each do |config|
        if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 14.0
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
        end
        xcconfig_path = config.base_configuration_reference.real_path
        xcconfig = File.read(xcconfig_path)
        xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
        File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
      end

      # 处理特定目标 BoringSSL-GRPC 的部分
      if target.name == 'BoringSSL-GRPC'
        target.source_build_phase.files.each do |file|
          if file.settings && file.settings['COMPILER_FLAGS']
            flags = file.settings['COMPILER_FLAGS'].split
            flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
            file.settings['COMPILER_FLAGS'] = flags.join(' ')
          end
        end
      end
    end
  end

end
